#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include <QEvent>
#include <QPoint>
#include <QPainter>
#include <QPaintDevice>
#include <QPaintEvent>
#include <QMouseEvent>
namespace Ui {
class MainWidget;
}

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    explicit MainWidget(QWidget *parent = 0);
    void paintEvent(QPaintEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    ~MainWidget();

private:
    QPixmap* pixmap;
    QPainter* painter;
    QPoint startPoint;
    QPoint endPoint;
    Ui::MainWidget *ui;
    bool flag;
};

#endif // MAINWIDGET_H
